package cn.com.cloud.io.controller;

import cn.com.cloud.io.service.UserService;
import cn.com.cloud.io.vo.UserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class UserProviderController {
    @Autowired
    private UserService userService;
    @RequestMapping(value = "/api/provider/register", method = RequestMethod.POST)
    public ResponseEntity<Object> register(@RequestBody UserEntity user) {

        if (user != null) {
            userService.save(user);
            return new ResponseEntity<Object>(user, HttpStatus.OK);
        }
        return new ResponseEntity<Object>("not found", HttpStatus.NOT_FOUND);
    }
}
